package cn.vihub.handler;

import cn.vihub.utils.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author 郜怀达
 * @version 1.0
 * @description: 统一异常处理类
 * @date 2022/9/14 23:16
 */

@RestControllerAdvice
public class GlobalExceptionHandler {

    /**
    * @description: 全局统一异常处理
    * @param: e
    * @return: com.bwie.utils.R
    * @author: 郜怀达
    * @date: 2022/9/15 11:41
    */
    @ExceptionHandler(MyRuntimeException.class)
    public Result<Boolean> error(Exception e) {
        return Result.error(e.getMessage());
    }
}
